scale_color_manual(values=c("blue", "red")) +
scale_fill_manual(values=c("blue", "red")) +
theme(axis.title.y=element_blank(),
axis.title.x=element_blank())
q()
library(ggplot2)
library(tidyverse)
##create fake data for polarized versus sorted
##polarized
data1<- NULL
data1$ideo<- c(rep("Very liberal", 10), rep("Liberal", 7), rep("Moderate", 2), rep("Conservative", 7), rep("Very Conservative", 10))
data1$ideo_num<- c(rep(0, 10), rep(1, 7), rep(2, 2), rep(3, 7), rep(4, 10))
data1$party<- c(rep("Dem", 18), rep("Rep", 18))
data1<- as.data.frame(data1)
data1$ideo_cat<- factor(data1$ideo, levels=c("Very liberal", "Liberal", "Moderate", "Conservative", "Very Conservative"), labels=c("Very Lib", "Lib", "Mod", "Cons", "Very Cons"), ordered=FALSE)
ggplot(data1, aes(x=ideo_cat, color=party, fill=party)) + stat_count() +
scale_color_manual(values=c("blue", "red")) +
scale_fill_manual(values=c("blue", "red")) +
theme(axis.title.y=element_blank(),
axis.title.x=element_blank())
##sorted
data2<- NULL
data2$ideo<- c(rep("Very liberal", 3), rep("Liberal", 12), rep("Moderate", 6), rep("Conservative", 12), rep("Very Conservative", 3))
data2$party<- c(rep("Dem", 18), rep("Rep", 18))
data2<- as.data.frame(data2)
data2$ideo_cat<- factor(data2$ideo, levels=c("Very liberal", "Liberal", "Moderate", "Conservative", "Very Conservative"), labels=c("Very Lib", "Lib", "Mod", "Cons", "Very Cons"), ordered=FALSE)
ggplot(data2, aes(x=ideo_cat, color=party, fill=party)) + stat_count() +
scale_color_manual(values=c("blue", "red")) +
scale_fill_manual(values=c("blue", "red")) +
theme(axis.title.y=element_blank(),
axis.title.x=element_blank())
q()
sample(names, 4, replace=FALSE)
names
students<- c("aria", "ariel", "caleb", "emily", "hope", "jordyn", "nick", "kendall", "claire", "megan")
students
sample(students, 4, replace=FALSE)
sample(students, 4, replace=FALSE)
sample(students, 4, replace=FALSE)
students<- c("aria", "ariel", "caleb", "emily", "hope", "jordyn", "nick", "kendall", "claire", "megan")
sample(students, 4, replace=FALSE)
q()
survey<- 5000*6.50*2
survey
ra<- 450*30
ra
11500/9
summer<- 27000
survey + ra+ summer
105500*0.15
15825+105500
ra<- 450*30*2
ra
survey+ra+summer
.15*119000
11900+17850
119000+17850
students<- c("aria", "ariel", "caleb", "emily", "hope", "jordyn", "nick", "kendall", "claire", "megan")
sample(students, 4, replace=FALSE)
.93*30
90*30
.90*30
.95*20
.92*20
.92*30
.91*30
.90*20
.85*30
.90*30
.85*20
.94*30
.92*20
.95*0
.95*30
.95*20
.87*30
.88*30
.86*20
27/30
27.9/30
27/30
18.4/20
.92*30
.88*30
.90*30
.8*20
.86*20
.92*30
.90*30
.88*20
27.6/0
27.6/30
27/30
7.6/20
17.6/20
95/30
.95*30
.96*30
.97*20
.87*30
.89*30
7.2/20
17.2/20
.9*20
.93*20
.93*30
.92*20
27.9/30
8.4/20
18.4/20
27.6/30
.94*30
.93*20
28.2/30
18.6/20
.92*30
.90*20
27.6/30
.93*30
25.5/30
.88*30
25.5/30
26.4/30
16.5/20
16.5/20
.85*0
.85*20
.83*20
26.4/30
.83*20
28.2/30
18.4/20
28.5/30
28.2/30
19/20
26.1/30
.88*30
17.2/20
.92*30
.90*30
.88*20
27.6/0
27.6/30
27.30
27/30
17.6/20
8.2/30
28./30
28.2/20
28.2/30
18.6/20
18/20
.85*20
.8*20
.82*20
96/8
125/8
120/8
95041+144000
4/5
3/5
56.81-31.10
foo$party<- c(rep, rep, rep, dem, dem, dem, dem, dem, dem)
foo$party<- c("rep", "rep", "rep", "dem", "dem", "dem", "dem", "dem", "dem")
party<- c("rep", "rep", "rep", "dem", "dem", "dem", "dem", "dem", "dem")
cong<- c("114", "115", "115", "114", "114", "114", "115", "115", "115")
pres<- c("opp", "co", "co", "co", "co", "co", "opp", "opp", "opp")
dv<- c(8, 2, 1, 4, 6, 3, 7, 9, 8)
reg1<- lm(dv ~ party + cong + pres)
summary(reg1)
cor(party, cong)
q()
139+137+115+252+128+201
137+115+252+128+201+328
28.3/30
60+36
55+38
32+31
17+24
32+31
63-41
a<- 5
b<- 50
i<- 50
c<- 45
(i-c)/(i+c)
.97*20
19.5/20
19/20
3/5
4.3/5
4.4/5
4.7+9+4.4+4.5
22.6/25
4.6/5
4.4/5
4.6/5
4.3/5
4.6/5
4.4/5
22.5/25
4.6/5
4.3/5
4.5/5
4.6/6
4.7/5
4.6/5
4.6+9.3+4.5+4.5
22.9/25
4.6+9+4.4+4.6
22.6/25
4.6+9.3+4.7+4.4
23/25
(4.8+9.5+4.6+4.6)/25
(4.9_9.7+4.8+4.7)/25
(4.9+9.7+4.8+4.7)/25
(4.9+9.6+4.8+4.7)/25
(4.6+9.5+4.8+4.7)/25
(4.5+9.4+4.8+4.4)
23.1/25
4.5/5
(4.6+9.3+4.5+4.4)/25
(4.8+9.5+4.7+4.8)
23.8/25
(4.8+9.3+4.7+4.8)/25
(4.7+8.5+4.5+4.4)/25
4.5/5
(4.7+8.4+4.4+4.3)/25
.88*50
(4.7+8.8+4.4+4.5)/25
(4.6+9+4.3+4.6)/25
4/5
4.2/5
4.3/5
4.4/5
4.5/5
4.6/5
4.7/5
(4.6+8.8+4.6+4.5)/25
(4.3+9.3+4.+4.8)/25
(4.5+8.6+4.4+4.6)/25
(4.6+9.2+4.4+4.7)
22.9/25
(4.8+8.5+4.2+4.4)/25
(4.6+8.4+4.6+4.6)/25
(4.6+9.3+4.6+4.6)/25
(4.5_9.2+4.6+4.4)/25
(4.5+9.2+4.6+4.4)/25
(4.6+8.8+4.4+4.4)/25
(4.8+9.3+4.5+4.7)/25
(4.6+8.6+4.5+4.3)/25
17/20
16/20
13/20
3/5
4/5
15/18
15/20
14/20
.9*30
16/20
.8*30
.7*30
21/30
23/30
15/20
14/20
27/30
18/20
16/20
17.20
17/20
.8*30
.85*30
.75*30
.65*30
17.5/20
17.5+17.5+17.5+9+9.5+9
17+17+18+9+9.25+9.5
79.75/90
90/90
80/90
80.75/90
10*10
.75*3
.75+.33+.75+.5+.33
377/15
445.35/15
86.75/90
.9338*90
84/90
85.5/90
86.5/90
will<- 86.5/90
(will-0.03)
(will-0.03)*90
83.8/90
will
27.4/30
27.5/30
27.3/30
28.4/30
27.8/30
80.75/90
81.5/90
q()
28/30
27/30
27.5/30
17.5+26+17+9+9.5
18+26+17+10+9
20+30+20_10_10
20+30+20+10+10
80/90
19+18.5+19+18+8.5+9
19+18+18+18+9+9
19+18.25+18.25+18+9+9
18.5+17+16.5+18.5+9+9.5
18.75+18+17+17.5+9.5+9.5
19+18.5+16.5+18.5+8.5+9.5
19+18+16.5+18.5+8.5+9.5
18.5+17+17+18.5+9+9.5
19.5+19+17.5+19+8.8+9.5
19+19+17.75+19+8.8+9.2
18+16.5+18+19.5+9.5+9.5
16.5/20
17.8/20
17.5+16.5+17.8+19.5+9.5+9.5
17.5+16.5+18+19.5+9.5+9.4
18+18.25+18+19+9.3+9.4
18+18.25+18+19+9.4+9.4
18+18.25+18.25+19+9.4+9.4
19+18.75+17.75+18+9+9.5
19+19+17.75+18+9+9.5
18+18.25+18.25+19+9.4+9.2
17.5+16.5+17.8+19.5+9.5+9.3
18.5+18.75+17.8+18.25+9.5+9.5
19+18.75+17.8+18.25+9.5+9.5
john_f<- 18.5+18.75+17.8+18.25+9.5+9.5
josh_e<- 19+19+17.75+18+9+9.5
will<- 18+18.25+18.25+19+9.4+9.2
lilly<- 17.5+16.5+17.8+19.5+9.5+9.3
jane<- 19+19+17.75+19+8.8+9.2
angelina<- 19.5+19+17.5+19+8.8+9.5
ben_f<- 18+16+15+18.25+8.8+9
ben_f
nicole_g<- 16+16+16+17+8.3+9.2
nicole_g
hayden<- 18+17.8+16+18+7.5+9
hayden
kelly<- 19+18.25+18.25+18+9+9.3
kelly
36/2
lars<- 18.5+16+15+17+7.5+8.5
lrs
lars
82.5-1.5
16.5/20
lauren<- 17.8+16.5+15+13+8+9.2
lauren
lauren-3
samy<- 18.5+17.3+17+18.5+9+9.2
samy
maura<- 18+18.5+18+19+9.2+9.2
maura
maura<- 18+18.5+18+19+9.3+9.2
maura
joe<- 17.5+17.5+18+18.6+8+9.3
joe
17.5/20
joe<- 17.5+17.7+18+18.7+8+9.3
joe
joe-3
joe<- 17.5+18+18+18.7+8+9.3
joe
joe-3
olivia<- 17.5+18.75+18.5+18.5+8.5+9.4
olivia
18.5/20
olivia<- 17.5+18.75+18.5+18.5+8.7+9.4
olivia
olivia<- 17.5+18.75+18.5+18.5+8.+9.4
olivia
olivia<- 17.5+18.75+18.5+18.5+8.8+9.4
olivia
jane<- 19+19+17.75+19+8.8+9.4
jane
lilly<- 17.5+16.5+17.8+19.5+9.5+9.4
lilly
will<- 18+18.25+18.25+19+9.4+9.3
will
ben_f<- 18+16+15+18.25+8.8+9.2
ben_f
nicole_g<- 16+16+16+17+8.3+9.4
nicole_g
hayden<- 18+17.8+16+18+7.5+9.3
hayden
lauren<- 17.8+16.5+15+13+8+9.4
lauren
maura<- 18+18.5+18+19+9.3+9.4
maura
joe<- 17.5+18+18+18.7+8.2+9.4
joe
joe-3
samy<- 18.5+17.3+17+18.5+8.8+9.2
samy
alvaro<- 19+18+16.5+18.5+8.8+9.5
alvaro
nicole_g<- 16+16+16+17+8.5+9.4
nicole_g
hayden<- 18+17.8+16+18+7.8+9.3
hayden
lars<- 18.5+16+15+17+7.8+8.5
lars
lars-1.5
lauren<- 17.8+16.5+15+13+8.8+9.4
lauren
lauren-3
joe<- 17.5+18+18+18.7+8.8+9.4
joe
joe-3
olivia<- 17.5+18.75+18.5+18.5+8.9+9.4
olivia
q()
(95*.25)+(89.72*.25)+(89.3*.25)+(96.05*.1)+(93*.15)
(96*.25)+(93.11*.25)+(92.25*.25)+(97.4*.1)+(95*.15)
q()
8.15*3500
8.15*6000
5.25*4500
5.25*3500
18375+23625+48900
60*100
60*20
190000-95041
27000/2
13500*9
121500*1.03
125145/9
14000*3
15/60
.25*15
1-.73
1-.55
.73-.27
.55-.45
27.95+29.95+31.95+29.95+32.95
(87+84)/2
(93+94)/2
(89+86)/2
(89+85)/2
428/60
.333*428
.33*428
141/60
900/60
27/500
141/60
120/60
q()
q()
p_na<- c(484+547+319+73)
p_na<- c(484,547,319,73)
p_a<- c(463, 529, 314, 74)
73/(sum(p_na))
74/sum(p_a)
(74+319)/sum(p_na)
(74+314)/sum(p_a)
g_na<- c(858, 1363, 1351, 539)
g_a<- c(812, 1364, 1277, 586)
539/sum(g_na)
586/sum(g_a)
(539+1351)/sum(g_na)
(586+1277)/sum(g_a)
q()
6*5
18/20
.9-.3
17.75/20
.8875-.3
.59*20
17.75/20
.8875-(7*.05)
.8875-(6*.05)
0.5875*20
28/30
.9*30
26/30
32/40
.85*40
36/40
27/30
28.30
28/30
33/40
28.5/30
27.5/30
27/30
5982/(5982+1059)
1175+344
1175+344+8+112+84+377
1519/2100
(377+112)/(377+112+84+8)
#Load data
setwd("C:/Users/lmh735/Dropbox (Political Science)/Partisanship and leadership-Trump/2021 POBE Submission/R&R/Replication Files")
data2.finish<- read.csv("Study_2.csv", header=TRUE)
##Create data for analyzing partisans pooled, dropping Independents
data2.partisans<- subset(data2.finish, data2.finish$OwnParty!="Independent")
names(data2.partisans)
xtabs(~ data2.partisans$Q30_2 + data2.partisans$leader_anxious)
xtabs(~ data2.partisans$Q30_3 + data2.partisans$leader_afraid)
q()
